<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core">

    <body>

        <ui:composition template="./../../template.xhtml">

            <ui:define name="title">
                title
            </ui:define>

            <ui:define name="title">
                Nové zadání
            </ui:define>

            <ui:define name="body">
                <h:form id="forecastForm" onkeypress="if (event.keyCode == 13) { document.getElementById('forecastForm:submitForecast').click(); return false; }">


                    <h:panelGrid columns="1">
                        <h:outputLabel styleClass="infoLabel" value="#{createMessageBean.info}"/>

                        <h:outputLabel value="Místo předpovědi" />
                        <h:panelGroup>
                            <h:inputText id="place" value="#{createMessageBean.place}"
                                         rendered="#{createMessageBean.firstStage}" required="true" requiredMessage="#{bundle.Error_requiredValue}"/>
                            <h:selectOneMenu styleClass="selectPlace" id="placeSelect" value="#{createMessageBean.selectedPlace}" rendered="#{!createMessageBean.firstStage}">
                                <f:selectItems value="#{createMessageBean.foundPlaces}"/>
                            </h:selectOneMenu>
                            <h:commandButton styleClass="changePlaceButton" value="Změnit" action="#{createMessageBean.changePlace}" rendered="#{!createMessageBean.firstStage}"/>
                            <h:message styleClass="messageStyle" for="place"/>

                        </h:panelGroup>



                        <h:outputLabel value="Datum" />
                        <h:panelGroup>
                            <h:inputText id="date" value="#{createMessageBean.date}" required="true" requiredMessage="#{bundle.Error_requiredValue}">
                                <f:convertDateTime pattern="dd.MM.yyyy" />
                            </h:inputText>
                            <h:message styleClass="messageStyle" for="date"/>
                        </h:panelGroup>
                        <h:panelGroup>
                            <h:commandButton styleClass="button" value="Najdi místo" action="#{createMessageBean.find}" rendered="#{createMessageBean.firstStage}"/>
                            
                            <h:commandButton  id="submitForecast" styleClass="button" value="Potvrdit" action="#{createMessageBean.confirm}" rendered="#{!createMessageBean.firstStage}"/>
                        </h:panelGroup>



                    </h:panelGrid>

                </h:form>
            </ui:define>

        </ui:composition>

    </body>
</html>
